package at.bherbst;

import java.io.Serializable;
import java.util.concurrent.locks.ReentrantLock;

import android.util.Log;

public class UDPData implements Serializable{


	public int value;
	public int count;
	public ReentrantLock lock;
	
	UDPData(){
		count=0;
		value=0;
		lock = new ReentrantLock();
	}

	public void setValue(int i, String sender) {
		this.value = i;
		count ++;
		lock.unlock();
		Log.d(sender,"Lock released");
		try {
			Thread.sleep(5);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		lock.lock();
		Log.d(sender,"Lock acquired by me");
	}
}
